//
//  DingdanzhangtaiTableViewCell.m
//  tianjin
//
//  Created by 鞠超 on 16/8/12.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "DingdanzhangtaiTableViewCell.h"

@implementation DingdanzhangtaiTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self)
    {
        [self p_setupView];
    }
    
    return self;
}

- (void )p_setupView
{
    self.image_product = [[UIImageView alloc] init];
    self.image_product.image = [UIImage imageNamed:@"gouwuche_product@2x.png"];
    [self.contentView addSubview:self.image_product];
    
    self.name = [[UILabel alloc] init];
    self.name.text = @"产品名称";
    self.name.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:self.name];
    
    self.guige = [[UILabel alloc] init];
    self.guige.text = @"规格: 12个";
    self.guige.font = [UIFont systemFontOfSize:16];
    self.guige.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.guige];
    
    self.number = [[UILabel alloc] init];
    self.number.text = @"x4";
    self.number.font = [UIFont systemFontOfSize:15];
    self.number.textAlignment = NSTextAlignmentRight;
    self.number.textColor = navi_bar_bg_color;
    [self.contentView addSubview:self.number];
    
    self.price = [[UILabel alloc] init];
    self.price.textColor = [UIColor redColor];
    self.price.text = @"￥8889.99";
    self.price.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:self.price];
    
    self.view_line = [[UIView alloc] init];
    self.view_line.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_line];
}

- (void )layoutSubviews
{
    [super layoutSubviews];
    
    self.image_product.frame = CGRectMake(10, 10, 80, 80);
    
    self.name.frame = CGRectMake(CGRectGetMaxX(self.image_product.frame) + 10, 13, SCREEN_WIDTH - CGRectGetMaxX(self.image_product.frame) - 20, 15);
    
    self.guige.frame = CGRectMake(CGRectGetMaxX(self.image_product.frame) + 10, CGRectGetMaxY(self.name.frame) + 15, SCREEN_WIDTH - CGRectGetMaxX(self.image_product.frame) - 10 - 50, 15);
    
    self.number.frame = CGRectMake(SCREEN_WIDTH - 10 - 50, 50 - 7.5, 50, 15);
    
    self.price.frame = CGRectMake(CGRectGetMaxX(self.image_product.frame) + 10, CGRectGetMaxY(self.guige.frame) + 13, SCREEN_WIDTH - CGRectGetMaxX(self.image_product.frame) - 20, 20);
    
    self.view_line.frame = CGRectMake(0, 99, SCREEN_WIDTH, 1);
}


@end
